home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1999 April: Mac OS SDK / Dev.CD Apr 99 SDK1.toast / Development Kits / Open Transport 1.3 / Open Transport SDK / Open Tpt Module Developer / Samples / DLPI Template / StreamLog / StreamLogApp.h < prev    next >
Encoding:
C/C++ Source or Header  |  1998-04-30  |  1.9 KB  |  84 lines  |  [TEXT/MPS ]

  1. /*
  2.     File:        StreamLogApp.h
  3.  
  4.     Contains:    Include files for the Stream logging application
  5.  
  6.     Copyright:    © 1995 by Apple Computer, Inc., all rights reserved.
  7.  
  8. */
  9.  
  10. #pragma once
  11.  
  12. #ifndef __OPENTRANSPORT__
  13. #include <OpenTransport.h>
  14. #endif
  15. #ifndef _MPS_STROPTS_
  16. #include <stropts.h>
  17. #endif
  18. #ifndef _MPS_STREAM_
  19. #include <mistream.h>
  20. #endif
  21. #ifndef _STRLOG_
  22. #include <strlog.h>
  23. #endif
  24.  
  25. #include <LDocApplication.h>
  26. #include "CTextDoc.h"
  27.  
  28. #define kBufferSize (1 << 10)
  29. #define kBufferMask kBufferSize-1
  30.  
  31. /*******************************************************************************
  32. ** Private OT APIs
  33. **
  34. ** We could use GetMessage, but then we'd have to have a buffer hanging around,
  35. ** so we use this interface to be more efficient (But it's not portable to
  36. ** other streams environments).
  37. ********************************************************************************/
  38.  
  39.     struct OTReadInfo
  40.     {
  41.         UInt32        fType;
  42.         UInt32        fCommand;
  43.         long        fSequence;
  44.         size_t        fBytes;
  45.         OSStatus    fError;
  46.     };
  47.  
  48.     typedef struct OTReadInfo    OTReadInfo;
  49.  
  50. extern "C"
  51. {
  52.     pascal OTBuffer*    OTReadMessage(StreamRef, OTReadInfo*);
  53. }
  54.  
  55. /*******************************************************************************
  56. ** StreamLogApp class
  57. ********************************************************************************/
  58.  
  59. class StreamLogApp : public LDocApplication
  60. {
  61. public:
  62.                         StreamLogApp();
  63.     virtual             ~StreamLogApp();
  64.     
  65.     virtual Boolean        ObeyCommand(CommandT inCommand, void *ioParam = nil);
  66.     virtual void        FindCommandStatus(CommandT inCommand,
  67.                             Boolean &outEnabled, Boolean &outUsesMark,
  68.                             Char16 &outMark, Str255 outName);
  69.  
  70.     virtual void    OpenDocument(FSSpec *inMacFSSpec);
  71.     virtual LModelObject*    MakeNewDocument();
  72.     virtual void    ChooseDocument();
  73.     virtual void    UseIdleTime(const EventRecord &inMacEvent);
  74.     
  75.     virtual void    OpenStream(strioctl* stri);
  76.     CTextDoc*        fTraceDoc;
  77.     CTextDoc*        fErrorDoc;
  78.     
  79.     StreamRef        fLogStream;
  80.     
  81.     int                fFillPtr[2], fEmptyPtr[2];
  82.     char            fBuffer[2][kBufferSize];
  83. };
  84.